<?php
/* @var $this UserController */
/* @var $model UserInfo */
/* @var $user_id */

$this->main_menu = MenuHelper::getArrayForMainMenu(true, false, false);

?>

<?php
$this->widget('bootstrap.widgets.TbTabs', array(
    'type'=>'tabs', // 'tabs' or 'pills'
    'tabs'=> array(
        array('label'=>'Alle Kunden', 'url'=>$this->createUrl('user/admin'), 'active'=>false),
        array('label'=>'NEU', 'url'=>$this->createUrl('user/create'), 'active'=>false),
        array('label'=>'Stammdaten', 'url'=>$this->createUrl('user/update', array('id'=>$user_id)), 'active'=>false),  
        array('label'=>'Info', 'url'=>$this->createUrl('user/info', array('user_id'=>$user_id)), 'active'=>true),
        array('label'=>'Rechnungsadressen', 'url'=>$this->createUrl('user/viewInvoiceAddresses', array('user_id'=>$user_id)), 'active'=>false),
        array('label'=>'Kurse', 'url'=>$this->createUrl('user/getCourseForUser', array('id'=>$user_id))),
    ),
));
?>

<?php 
    $model = UserInfo::model();
    $recorded_by = $this->staffArray(Staff::model()->findAll());//array('Svetlana'=>'Svetlana', 'Claudia'=>'Claudia', 'Bruno'=>'Bruno','Jasmine'=>'Jasmine', 'Stefanie'=>'Stefanie', 'Simon'=>'Simon',);
?>

<?php    
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'horizontalForm',
	'type'=>'horizontal',
)); ?>
     
<fieldset>
    <?php echo $form->textAreaRow($model, 'info', array('class'=>'span7')); ?>
    <?php echo $form->dropDownListRow($model, 'recorded_by', $recorded_by); ?>
</fieldset>
    
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'OK')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Zurücksetzen')); ?>
</div>
 
<?php $this->endWidget(); ?>

<?php
    $info = UserInfo::model()->findAllByPk($user_id);

    $dataProvider=new CActiveDataProvider('UserInfo', array(
    'criteria'=>array(
        'condition'=>'user_id=' . $user_id,
    ),
));
?>

<?php
$this->widget('bootstrap.widgets.TbGridView', array(
    'dataProvider'=>$dataProvider,//$model->search(),
    'template'=>"{items}",
    'columns'=>array(
    	'info',
		'date',
		'recorded_by',
		array (
            'class'=>'CButtonColumn',
            'template'=>'{delete}',
            'buttons' => array(
              'delete' => array(
                'url'=>'Yii::app()->createUrl("user/deleteInfo", array("id"=>$data->id, "user_id"=>' . $user_id . '))',  
                'imageUrl'=>Yii::app()->request->baseUrl.'/images/delete.png',
              ),  
            ),
        ),
	),
));
    
?>


